package bookManager;

import bookManager.operation.IOperation;

import java.util.Arrays;

abstract public class User {
    private int userId;
    private String name;
    private String password;
    //private boolean isAdmin;

    //用来完成用户的一些操作，用结构IOperation接口
    IOperation[] operations;

    public void doOperation(int choice) {
        operations[choice].work();
    }

    // menu 是一个抽象方法, 在具体的子类中, 来实现这个方法的细节
    // 返回值是一个 int, 表示当前用户输入的选项是几
    public abstract int menu();

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }


    @Override
    public String toString() {
        return "User{" +
                "userId=" + userId +
                ", name='" + name + '\'' +
                ", password='" + password + '\'' +
                ", operations=" + Arrays.toString(operations) +
                '}';
    }
}
